<template>
  {{ msg }}
  <button data-aid="world" @click="handleClick('Vue', $event)">
    事件对象按钮
  </button>
</template>

<script>
import { reactive, toRefs } from "vue";

export default {
  setup() {
    const state = reactive({
      msg: "Hello",
    });
    const handleClick = (argp, e) => {
      state.msg = state.msg + argp + e.srcElement.dataset.aid;
      // console.log(e)		//可以查看e的返回值
      e.srcElement.style.background = "red";
    };
    return {
      ...toRefs(state),
      handleClick,
    };
  },
};
</script>
